module manager {

    export class LaunchOptionsManager {

        public static readonly ROOM_ID: string = "room_id";

        public options: LaunchOption;

        public constructor() {
            if (GameManager.isProduct) {
                this.options = wx.getLaunchOptionsSync();
                egret.log("小程序启动选项:", this.options);
            }
        }

        public getInviterUid(): any {
            if (!GameManager.isProduct) {
                return "";
            }
            if (this.options.query != null && this.options.query.inviter_uid != null) {
                return this.options.query.inviter_uid;
            }
            return "";
        }


        public getOption(key: string): string {
            if (!GameManager.isProduct) {
                return "";
            }
            if (this.options.query.hasOwnProperty(key)) {
                return this.options.query[key];
            }
            return "";
        }

        public static getOptionValue(query: any, key: string): string {
            if (!GameManager.isProduct) {
                return "";
            }
            if (query.hasOwnProperty(key)) {
                return query[key];
            }
            return "";
        }

    }

}